package com.ljx.itbbs.common.constant;

/**
 * 缓存的key常量
 * @Author LiJunXi
 * @Date 2024-03-01 15:49
 */
public class CacheConstants {

    /**
     * 项目名称
     */
    public static final String PROJECT = "itbbs:";

    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 登录验证码
     */
    public static final String LOGIN_CODE = "login_code:uuid_%s";

    /**
     * 登录UUID，唯一标识
     */
    public static final String LOGIN_UUID = "login_uuid:";

    /**
     * 登录账户密码错误次数
     */
    public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:username_%s";

    /**
     * 用户信息
     */
    public static final String USER_INFO = "user:uid_%s";

    /**
     * 文章信息
     */
    public static final String ARTICLE_INFO = "article:id_%s";
    public static final String ARTICLE_CATEGORY = "article_category";
    public static final Long ARTICLE_CATEGORY_EXPIRE = 2L;
    public static final String ARTICLE_CATEGORY_LOCK = "article_category_lock";
    public static final Long ARTICLE_CATEGORY_LOCK_TIME = 1L;



    /**
     * 评论信息
     */
    public static final String COMMENT_INFO = "comment:id_%s";

    /**
     * 签到信息（按月）
     */
    public static final String SIGN_KEY = "sign:key_%s";

    /**
     * 优惠券锁
     */
    public static final String COUPON_LOCK = "coupon_lock:key_%s";
    public static final Long COUPON_LOCK_EXPIRE = 5L;

    /**
     * 敏感词
     */
    public static final String SENSITIVE_WORDS = "sensitive_word";

    /**
     * 优惠券库存
     */
    public static final String COUPON_STOCK = "coupon_stock:";

    /**
     * 板块信息
     */
    public static final String PLATE_ALL = "plate_all";
    public static final Long PLATE_ALL_EXPIRE = 2L;

    public static String getKey(String key, Object... objects) {
        return PROJECT + String.format(key, objects);
    }




}
